<HTML>
<!-- (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP -->


<HEAD>
<TITLE>Jena Relational Database backend</TITLE>
<link href="../styles/doc.css" rel="stylesheet" type="text/css" />
</HEAD>



<BODY bgcolor="#FFFFFF">



<h1>Jena2 Database Interface</h1>



<p>&nbsp;</p>
<p>This document refers to the database subsystem that ships with Jena for 
compatibility reasons.</p>
<p>All new development should carried out with either
<a href="http://jena.sf.net/TDB">TDB</a> or <a href="http://jena.sf.net/SDB">SDB</a>.</p>
<p><a href="http://jena.sf.net/TDB">TDB</a> is a non-transactional, faster 
database solution for use by a single system.&nbsp; It scales well beyond SDB 
and is simpler to setup.</p>
<p><a href="http://jena.sf.net/SDB">SDB</a> is a system that uses relational 
databases for storage of RDF and OWL.&nbsp; It supports many open source and 
commercial databases including MySQL, PostgreSQL, Oracle 11g, Microsoft SQL 
server and IBM DB2. It scales to graphs of 100 million triples.</p>
<p>Both these storage subsystems are supported by
<a href="http://www.joseki.org/">Joseki</a>.</p><hr>
<p>&nbsp;</p>
<p>Jena provides persistent storage of RDF data in relational databases. The 
same interfaces such as <code>Model</code>, <code>Resource</code> and <code>
Query</code>, are used to access and manipulate persistently stored RDF. The 
application does not directly access the database nor does it need to be aware 
of the database schema.</p>
<p>Implementations for MySQL, HSQLDB, PostgreSQL, Oracle and Microsoft SQL Server are 
provided and other databases have been added by 3rd parties.</p>
<h2>Documents : Quick Links</h2>
<ul>
  <li><a href="creating-db-models.html">How To Create Persistent Models</a></li>
  <li>Database specific notes<ul>
    <li><a href="hsql-howto.html">HSQLDB</a></li>
    <li><a href="mysql-howto.html">MySQL</a></li>
    <li><a href="postgresql-howto.html">PostgreSQL</a></li>
	<li><span style="font-weight: 400"><font size="2">
	<a href="derby-howto.html">Derby</a></font></span></li>
    <li><a href="oracle-howto.html">Oracle</a></li>
    <li><a href="mssql-howto.html">Microsoft SQL Server</a></li>
  </ul>
  </li>
</ul>



  <h2><a name="features"></a>Features</h2>



<p>The Jena2 persistence subsystem implements the Jena Model 
interface providing persistence for models through use of a back-end relational database 
engine.&nbsp; The default Jena2 database 
<a href="layout.html">layout</a> uses a denormalized schema in which literals and resource URIs are stored 
directly in statement tables. The Jena2 layout enables faster insertion and retrieval 
for fine-grained API operations at the cost of storage over a normalized triples 
and nodes schema. Configuration options are available that 
give Jena2 users some control over the degree of denormalization in order to 
reduce storage consumption.</p>
<p>The persistence subsystem supports a <a href="fastpath.html">
Fastpath</a> capability for SPARQL queries that dynamically generates SQL queries 
for SPARQL Basic Graph Patterns to perform significant parts of the SPARQL query within the database engine. </p>
<p>For an overview of creating and accessing persistent Jena models, see &quot;<a href="creating-db-models.html">How 
To Create Persistent Models</a>&quot;. A summary of the various configuration options available is given in
<a href="options.html">Options</a>.</p>
<h2><a name="dbengines"></a>Database Engine Support</h2>



<p>The following table lists the database engines and JDBC drivers 
that are known to work with Jena. Older newer versions usually work but 
wil need testing; newer versions generally work. Please report further 
configurations to <a href="mailto:jena-dev@groups.yahoo.com">
jena-dev@groups.yahoo.com</a>.</p>
<p>See the database-specific <i>how-to</i> documents for more 
details on using these databases for Jena applications (<a href="hsql-howto.html">HSQLDB,</a> <a href="mysql-howto.html">MySQL</a>,
  <a href="oracle-howto.html">Oracle</a>,
  <a href="postgresql-howto.html">PostgreSQL</a>,
  <a href="mssql-howto.html">MS SQL Server</a>).
  </p>



<blockquote>
  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="table1">
    <tr>
      <th>Database Engine</th>
      <th>JDBC Driver</th>
    </tr>
    <tr>
      <td style="text-align: left">HSQLDB 1.8.0</td>
      <td style="text-align: left">&nbsp;</td>
    </tr>
    <tr>
      <td style="text-align: left">MySQL 4.1.11<br>MySQL 5.0.18</td>
      <td style="text-align: left">JDBC driver versions: 3.0, 3.1, 5.0</td>
    </tr>
    <tr>
      <td style="text-align: left">PostgreSQL 7.3<br>PostgreSQL 8.0</td>
      <td style="text-align: left">JDBC driver 7.3<br>JDBC driver 8.0</td>
    </tr>
    <tr>
      <td style="text-align: left">Apache Derby 10.1</td>
      <td style="text-align: left">&nbsp;</td>
    </tr>
    <tr>
      <td style="text-align: left">Oracle 10 XE</td>
      <td style="text-align: left">Oracle ojdbc14 driver (thin driver) 10.2.0.2</td>
    </tr>
    <tr>
      <td style="text-align: left">Oracle 9i <span class="parahead1">Release 2</span></td>
      <td style="text-align: left">Oracle ojdbc14 driver (thin driver) 10.2.0.2</td>
    </tr>
    <tr>
      <td style="text-align: left">Oracle 10g Release 2</td>
      <td style="text-align: left">Oracle ojdbc14 driver (thin driver) 10.2.0.2</td>
    </tr>
    <tr>
      <td style="text-align: left">Microsoft SQL Server 2005 Express SP1</td>
      <td style="text-align: left">Microsoft SQL Server 2005 JDBC Driver</td>
    </tr>
    <tr>
      <td style="text-align: left">Microsoft SQL Server 2000<br>
      Microsoft SQL Server Desktop Edition</td>
      <td style="text-align: left">Microsoft SQL Server 2005 JDBC Driver<br>jTDS version 1.2</td>
    </tr>
  </table>
</blockquote>



  <h3>MySQL Notes</h3>
<ul>
  <li>The 5.0.0-beta driver does not work reliably (bug to do with concurrency 
  in the JDBC driver). This was fixed in 5.0 production drivers.</li>
  <li>Drivers from the 3.1 series work with Jena 2.4 and later.</li>
</ul>



  <p>Individuals in the Jena user community have developed Jena drivers for 
  other database engines. See the <a href="../jena-faq.html#db-2">Jena FAQ</a> 
  for a list of such drivers. For details on developing your own Jena database 
  driver, see the <a href="portNotes.html">porting notes</a>.</p>



  <p>Note that the database layout used by Jena is not intended for direct 
  access by users and applications. The database should only be accessed 
  indirectly, through the Jena API. This is because there is not a simple 
  mapping from Jena models and statements into database tables. For example, 
  resource URIs and literal values are encoded such that the plain text values 
  may not be easily discernable. Users should not attempt to access the 
  Jena database tables using SQL or other relational database tools unless they 
  really know what they are doing. For those interested, a details on the Jena 
  database schema are provided in the <a href="layout.html">layout notes</a>.</p>



  </BODY>



</HTML>
